#include "TcpServer.hpp"
#include "ServerCal.hpp"


static void Usage(const std::string &proc)
{
    std::cout << "\nUsage: " << proc << " port\n" << std::endl; 
}

// ./servercacl 8081
int main(int argc, char *argv[])
{
    if(argc != 2){
        Usage(argv[0]);
        exit(0);
    }
    uint16_t port = std::stoi(argv[1]);

    ServerCal cal;
    std::cout << "port: " << port << std::endl;
    TcpServer *tsvr = new TcpServer(port, std::bind(&ServerCal::Calculator, &cal, std::placeholders::_1));
    tsvr->InitTcpServer();
    daemon(0,0);
    tsvr->Start();

    return 0;
}